<!DOCTYPE html>
<html lang="zh">
	<head>
    	<meta charset="utf-8">
    	<!-- IE最高引擎 -->
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <title>后台管理</title>		

		<!-- Fav and touch icons -->
		<link rel="shortcut icon" href="../../static/ico/favicon.png" type="image/x-icon" />    
	    <!-- Css files -->
	    <link href="../../static/admin/css/bootstrap.min.css" rel="stylesheet">		
	    <link href="../../static/admin/css/style.min.css" rel="stylesheet">
		<!-- <link rel="stylesheet" href="../../static/editormd/css/style.css" /> -->
    	<link rel="stylesheet" href="../../static/editormd/css/editormd.css" />		
	</head>
<body>
<div class="main_a">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header"><i class="fa fa-laptop"></i> 添加文章</h3>
			<ol class="breadcrumb">
				<li><i class="fa fa-home"></i>Home</li>
				<li><i class="fa fa-laptop"></i>添加文章</li>  	
			</ol>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
    		<form method="post" action="/admin/add">

    			<input class="form-control pull-left" name="blog_title" type="text" placeholder="请输入标题，不要超过20个字符..." required autofocus/>

    			<div id="test-editormd">
    				<textarea class="blog_body" name="blog_body"></textarea>
                </div>

                <label class="blog_text pull-left" for="title" >标签:</label>

                <input name="blog_tags" type="text" id="blog-title" class="form-control pull-left" placeholder="请输入标签，用逗号分开" required autofocus/>
                
                <label class="blog_text pull-left" for="title">分类:</label>

                <select class="blog_category pull-left" name="blog_category">
                {% for i in category %}
                <option value={{ i.id }}>{{i.name}}</option>
                {% endfor %}
                </select>
                
                <label class="blog_text pull-left" for="title">简介:</label>
                <textarea name="blog_about" class="blog_about pull-left" required autofocus></textarea>

                <input type="submit" class="btn btn-primary" value="提交" />
                
            </form>
        </div>
    </div>
</div>

<!-- start: JavaScript-->	
<script src="../../static/editormd/jquery.min.js"></script>
<script src="../../static/editormd/editormd.min.js"></script>
<script type="text/javascript">
    var testEditor;
    $(function() {
        testEditor = editormd("test-editormd", {
            width   : "100%",
            height  : 640,
            syncScrolling : "single",
            path    : "../../static/editormd/lib/",
            //打开上传图片
            imageUpload : true,
            imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL : "/uploadfile",
            saveHTMLToTextarea : true,
            toolbarIcons : function() {
            // Or return editormd.toolbarModes[name]; // full, simple, mini
            // Using "||" set icons align right.
            //return ["undo", "redo", "|", "bold", "hr", "image", "|", "preview", "watch", "|", "fullscreen", "file", "faicon", "||", "watch", "fullscreen", "preview"]
            return  ["undo", "redo", "|", "bold", "del", "italic", "hr", "|", "list-ol", "list-ul", "|", "h1", "h2", "h3", "h4", "h5", "h6", "|", "link", "reference-link", "|", "image", "table", "datetime", "|", "preview", "watch", "|", "goto-line", "clear", "fullscreen", ];
            },

            //下面这一行将使用dark主题
            //editorTheme: "pastel-on-gray",
            theme: "gray",
            previewTheme : "dark"
            //editor.md期望得到一个json格式的上传后的返回值，格式是这样的：
            /*
              {
                  success : 0 | 1,           // 0 表示上传失败，1 表示上传成功
                  message : "提示的信息，上传成功或上传失败及错误信息等。",
                  url     : "图片地址"        // 上传成功时才返回
              }
            */
        });
    });
</script>
<!-- end: JavaScript-->
	
</body>
</html>